package com.zhuimeng.serviceconsume.controller;

import com.zhuimeng.service.HelloService1;
import com.zhuimeng.service.HelloService2;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class HelloController {


    @Reference
    HelloService1 service1;

    @Reference
    HelloService2 service2;

    @RequestMapping("/{name}")
    public String sayHello(HttpServletRequest request, @PathVariable String name){
        if (name.equalsIgnoreCase("favicon.ico")){
            return null;
        }
        return "Server1返回的结果："+service1.sayHello(name)+"\n"+"Server2返回的结果："+service2.sayHello(name);
    }
}
